package com.jz.nacos.service.controller;

import com.jz.commom.api.dto.request.Payment;
import com.jz.commom.api.dto.response.CommonResult;
import com.jz.nacos.service.config.NacosConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
//import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@Api
@ApiModel(value = "支付接口")
public class PaymentController {

    @ApiOperation(value = "根据ID查询订单")
    @GetMapping(value = "/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return CommonResult.fail("查询无对应数据",null);
    }


    /**
     * testSentinel
     * @return CommonResult
     */
    @ApiOperation(value = "testSentinel")
    @GetMapping(value = "/payment/testSentinel")
    public CommonResult testSentinel(){
        return CommonResult.success("ok1",new Date());
    }


    @Autowired
    NacosConfig nacosConfig;

    /**
     * testSentinel
     * @return CommonResult
     */
    @ApiOperation(value = "getChange")
    @GetMapping(value = "/payment/getChange")
    public CommonResult getChange(){
        return CommonResult.success(nacosConfig.getMyfrom()+":"+nacosConfig.getYourname2()+":"+nacosConfig.getMyappname(),new Date());
    }


    /**
     * testSentinel
     * @return CommonResult
     */
    @ApiOperation(value = "rpcgetChange")
    @GetMapping(value = "/payment/rpcgetChange")
    public CommonResult rpcgetChange(){
        return CommonResult.success(nacosConfig.getMyfrom()+":"+nacosConfig.getYourname2()+":"+nacosConfig.getMyappname(),new Date());
    }

}
